package com.neuedu.hrsystem.person.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.hrsystem.bean.Dept;
import com.neuedu.hrsystem.person.dao.DeptDao;

@Repository
public class DeptDaoImpl implements DeptDao {
	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	
	@Override
	public List<Dept> findAll() {
		return sqlSessionTemplate.getMapper(DeptDao.class).findAll();
	}

	@Override
	public int countDept() {
		return sqlSessionTemplate.getMapper(DeptDao.class).countDept();
	}

	@Override
	public int addDept(Dept d) {
		return sqlSessionTemplate.getMapper(DeptDao.class).addDept(d);
	}

	@Override
	public int updateDept(Dept d) {
		return sqlSessionTemplate.getMapper(DeptDao.class).updateDept(d);
	}

	@Override
	public int deleteDept(int deptno) {
		return sqlSessionTemplate.getMapper(DeptDao.class).deleteDept(deptno);
	}

}
